import request from "./request";

export default {
  // 小程序快捷登录，使用 code 授权码
  minappLogin(query) {
    return request({
      method: "POST",
      url: "/app-api/miniapp/auth/minapp-login",
      data: query,
    });
  },
  // 使用工号/手机号和密码登录
  login(query) {
    return request({
      method: "POST",
      url: "/app-api/miniapp/auth/login",
      data: query,
    });
  },
  // 刷新令牌
  refreshToken(query) {
    return request({
      method: "POST",
      url: "/app-api/miniapp/auth/refresh-token?refreshToken=" + query.refreshToken,
      data: query,
    });
  },
  // 登出系统
  logout(query) {
    return request({
      method: "POST",
      url: "/app-api/miniapp/auth/logout",
      data: query,
    });
  },
  // 获得登录用户信息
  getUserInfo(query) {
    return request({
      method: "GET",
      url: "/app-api/miniapp/auth/get-permission-info",
      data: query,
    });
  },
  // 重置登录密码
  resetPassword(query) {
    return request({
      method: "PUT",
      url: "/app-api/miniapp/auth/reset-password",
      data: query,
    });
  },
  // 修改用户个人密码
  updatePassword(query) {
    return request({
      method: "PUT",
      url: "/admin-api/system/user/profile/update-password",
      data: query,
    });
  },
  // 上传用户个人头像
  updateAvatar(query) {
    return request({
      method: "POST",
      url: "/admin-api/system/user/profile/update-avatar",
      data: query,
    });
  },
}